package org.desktop.web.client.util;

import java.util.HashMap;
import java.util.Map;

import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;

public class Util {
	public static void showWaitCursor() {
//	    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "wait");
	    RootPanel.getBodyElement().getStyle().setProperty("cursor", "wait");
	}

	public static void showDefaultCursor() {
//	    DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", "default");
		RootPanel.getBodyElement().getStyle().setProperty("cursor", "default");
	}

	public static Map<String,String>  getHeaders(){
		Map<String,String> headers = new HashMap<String, String>();
		if(Cookies.getCookie("token")==null || !Cookies.getCookie("token").equals("")){
			headers.put("token",Cookies.getCookie("token"));
			
		}
		return headers;
	}

	public static void showAlert(String title, String message,ImageResource icon) {
		AlertMessageBox box = new AlertMessageBox(title, message);
		box.setIcon(icon);
		box.setModal(true);
		box.show();
	}
}
